<template>
	<view class="bg-theme flex-1 flex-col px-3">
		<view class="text-white font-600 u-text-center" style="font-size: 64rpx;padding-top: 100rpx;">
			{{vuex_user.credit_score||0}} <text>分</text>
		</view>
		<view class="d-flex justify-center pt-2">
			<image src="../../static/imgs/scoreCard.png" style="width: 48rpx;height: 48rpx;" mode="">
			</image>
			<view class="text-white font-600 ps-2 font-16">我的信用分</view>
		</view>
		<view class="list" v-if="list.length">
			<view class="item bg-white pt-2 pb-3 px-3 font-14 mb-3" v-for="item,index in list" :key="index">
				<view class="font-600 text-222426 pt-1">信用分 <text class="px-1"> {{item.credit_score > 0 ? '+' : ''}}{{item.credit_score}} 分</text></view>
				<view class="text-666D73 py-2">
					增加时间：<text
						class="text-black font-600">{{moment(item.createtime*1000).format('yyyy/MM/DD HH:mm') }}</text>
				</view>
				<view class="text-666D73 font-500">
					类<text class="text-white">类型</text>型：{{item.memo}}
				</view>
			</view>
		</view>
		<view class="empty d-flex justify-content-center flex-column align-items-center pt-5" v-else>
			<image src="../../static/imgs/empty.png" class="img" style="width: 288rpx;height: 304rpx;" />
			<view class="text-AAB5BF ">暂时没有数据</view>
		</view>
	</view>
</template>

<script>
	import moment from 'moment'
	export default {
		data() {
			return {
				moment,
				list: [],
				current_page: 1,
				last_page: 1,
				page: 1,
			}
		},
		onLoad() {
			this.getList()
		},
		onReachBottom() {
			if (this.current_page == this.last_page) return
			this.page += 1
			this.getList()
		},
		methods: {
			getList() {
				uni.showLoading({
					title: '加载中'
				})
				this.$u.api.getCreditLogsApi({
					page: this.page,
					list_rows: 10,
				}).then(res => {
					if (res.code) {
						this.list.push(...res.data.data)
						this.current_page = res.data.current_page
						this.last_page = res.data.last_page
					} else {
						this.list = []
						this.$u.toast(res.msg)
					}
				}).finally(() => {
					uni.hideLoading()
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.list {
		margin-top: 78rpx;

		.item {
			border-radius: 24rpx 24rpx 24rpx 24rpx;
		}
	}
	.empty {
		padding-top: calc(30vh - 144rpx) !important;
	
	
	}
</style>